package com.easemob.chat;

import android.content.Context;
import com.easemob.EMCallBack;
import com.easemob.EMValueCallBack;
import com.easemob.analytics.EMPerformanceCollector;
import com.easemob.analytics.EMTimeTag;
import com.easemob.chat.core.XmppConnectionManager;
import com.easemob.chat.core.e;
import com.easemob.exceptions.EMExceptionUtils;
import com.easemob.exceptions.EMPermissionException;
import com.easemob.exceptions.EaseMobException;
import com.easemob.util.DateUtils;
import com.easemob.util.EMLog;
import java.io.PrintStream;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.Hashtable;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import org.jivesoftware.smack.Connection;
import org.jivesoftware.smack.PacketListener;
import org.jivesoftware.smack.XMPPConnection;
import org.jivesoftware.smack.XMPPException;
import org.jivesoftware.smack.filter.PacketExtensionFilter;
import org.jivesoftware.smack.filter.PacketTypeFilter;
import org.jivesoftware.smack.packet.IQ;
import org.jivesoftware.smack.packet.IQ.Type;
import org.jivesoftware.smack.packet.Message;
import org.jivesoftware.smack.packet.Packet;
import org.jivesoftware.smack.packet.PacketExtension;
import org.jivesoftware.smack.packet.Presence;
import org.jivesoftware.smack.packet.Presence.Type;
import org.jivesoftware.smackx.Form;
import org.jivesoftware.smackx.FormField;
import org.jivesoftware.smackx.muc.Affiliate;
import org.jivesoftware.smackx.muc.HostedRoom;
import org.jivesoftware.smackx.muc.InvitationListener;
import org.jivesoftware.smackx.muc.MultiUserChat;
import org.jivesoftware.smackx.muc.RoomInfo;
import org.jivesoftware.smackx.muc.UserStatusListener;
import org.jivesoftware.smackx.packet.MUCUser;
import org.jivesoftware.smackx.packet.MUCUser.Accept;
import org.jivesoftware.smackx.packet.MUCUser.Apply;
import org.jivesoftware.smackx.packet.MUCUser.Decline;
import org.jivesoftware.smackx.packet.MUCUser.MucType;

public class EMGroupManager
{
  public static final String MUC_NS_USER = "http://jabber.org/protocol/muc#user";
  private static String TAG = "group";
  private static final String PERMISSION_ERROR_ADD = "only group owner can add member";
  private static final String PERMISSION_ERROR_REMOVE = "only group owner can remove member";
  private static final String PERMISSION_ERROR_DELETE = "only group owner can delete group";
  private static final String PERMISSION_ERROR = "only group owner has this permission";
  private static final int DEFAULT_MAX_USERS = 200;
  Map<String, EMGroup> allGroups = new Hashtable();
  private XmppConnectionManager xmppConnectionManager;
  private Map<String, MultiUserChat> multiUserChats = new HashMap();
  private static EMGroupManager instance = new EMGroupManager();
  private Context appContext;
  ArrayList<GroupChangeListener> groupChangeListeners = new ArrayList();
  private boolean autoAcceptInvitation = true;
  ArrayList<GroupChangeEvent> offlineGroupEvents = new ArrayList();
  private final MucApplyListener applyListener = new MucApplyListener();
  private boolean allGroupLoaded = false;
  private ExecutorService threadPool = Executors.newCachedThreadPool();
  private Object mutex = new Object();
  private boolean receivedQuery = false;
  private MUCInvitationListener invitationListener;

  public static EMGroupManager getInstance()
  {
    return instance;
  }

  void init(XmppConnectionManager paramXmppConnectionManager)
  {
    EMLog.d(TAG, "init group manager");
    this.appContext = EMChat.getInstance().getAppContext();
    this.xmppConnectionManager = paramXmppConnectionManager;
    this.invitationListener = new MUCInvitationListener(null);
    MultiUserChat.addInvitationListener(paramXmppConnectionManager.getConnection(), this.invitationListener);
    this.multiUserChats.clear();
    PacketTypeFilter localPacketTypeFilter = new PacketTypeFilter(Presence.class);
    MUCPresenceListener localMUCPresenceListener = new MUCPresenceListener();
    XMPPConnection localXMPPConnection = paramXmppConnectionManager.getConnection();
    localXMPPConnection.addPacketListener(localMUCPresenceListener, localPacketTypeFilter);
    PacketExtensionFilter localPacketExtensionFilter = new PacketExtensionFilter("x", "http://jabber.org/protocol/muc#user");
    localXMPPConnection.addPacketListener(this.applyListener, localPacketExtensionFilter);
  }

  private synchronized void syncLoadGroups(EMCallBack paramEMCallBack)
  {
    if (this.allGroupLoaded)
    {
      if (paramEMCallBack != null)
        paramEMCallBack.onSuccess();
      return;
    }
    loadGroups();
  }

  public void loadAllGroups(final EMCallBack paramEMCallBack)
  {
    new Thread()
    {
      public void run()
      {
        EMGroupManager.this.syncLoadGroups(paramEMCallBack);
      }
    }
    .start();
  }

  public List<EMGroup> getAllGroups()
  {
    return Collections.unmodifiableList(new ArrayList(this.allGroups.values()));
  }

  public EMGroup getGroup(String paramString)
  {
    return (EMGroup)this.allGroups.get(paramString);
  }

  public void loadAllGroups()
  {
    syncLoadGroups(null);
  }

  private void loadGroups()
  {
    EMTimeTag localEMTimeTag = new EMTimeTag();
    localEMTimeTag.start();
    this.allGroups = e.a().f();
    EMLog.d(TAG, "load all groups from db. size:" + this.allGroups.values().size());
    this.allGroupLoaded = true;
    if ((this.allGroups != null) && (this.allGroups.size() > 0))
      EMPerformanceCollector.collectLoadAllLocalGroups(this.allGroups.size(), localEMTimeTag.stop());
  }

  public void joinGroupsAfterLogin()
  {
    Thread local2 = new Thread()
    {
      public void run()
      {
        List localList = EMGroupManager.this.getAllGroups();
        EMLog.d(EMGroupManager.TAG, "join groups. size:" + localList.size());
        Iterator localIterator = localList.iterator();
        while (localIterator.hasNext())
        {
          EMGroup localEMGroup = (EMGroup)localIterator.next();
          String str = EMContactManager.getEidFromGroupId(localEMGroup.getGroupId());
          try
          {
            EMGroupManager.this.getMUC(str);
          }
          catch (Exception localException)
          {
            localException.printStackTrace();
          }
        }
        EMLog.d(EMGroupManager.TAG, "join groups thread finished.");
      }
    };
    local2.start();
  }

  private String generateGroupId()
  {
    return DateUtils.getTimestampStr();
  }

  public EMGroup createPublicGroup(String paramString1, String paramString2, String[] paramArrayOfString, boolean paramBoolean)
    throws EaseMobException
  {
    return createPublicGroup(paramString1, paramString2, paramArrayOfString, paramBoolean, 200);
  }

  private String[] filterOwnerFromMembers(String paramString, String[] paramArrayOfString)
    throws EaseMobException
  {
    if ((paramArrayOfString == null) || (paramArrayOfString.length < 1))
      return paramArrayOfString;
    int i = 0;
    for (int j = 0; j < paramArrayOfString.length; j++)
    {
      if (paramArrayOfString[j].equals(paramString))
        i++;
      if ((paramArrayOfString[j] == null) || (paramArrayOfString[j].equals("")))
        throw new EaseMobException("Your added a null number, Please add valid members!");
    }
    if (i == 0)
      return paramArrayOfString;
    j = paramArrayOfString.length - i;
    if (j == 0)
      throw new EaseMobException("Please add members who should not be the owner!");
    String[] arrayOfString = new String[j];
    int k = 0;
    int m = 0;
    while (k < paramArrayOfString.length)
    {
      if (!paramArrayOfString[k].equals(paramString))
      {
        arrayOfString[m] = paramArrayOfString[k];
        m++;
      }
      k++;
    }
    return arrayOfString;
  }

  public EMGroup createPublicGroup(String paramString1, String paramString2, String[] paramArrayOfString, boolean paramBoolean, int paramInt)
    throws EaseMobException
  {
    String str1 = generateGroupId();
    String str2 = EMChatManager.getInstance().getCurrentUser();
    String str3 = EMContactManager.getEidFromGroupId(str1);
    String[] arrayOfString1 = filterOwnerFromMembers(str2, paramArrayOfString);
    if ((arrayOfString1 == null) && (paramInt < 1))
      throw new EaseMobException(-1018, "the max group members are reached!");
    if ((arrayOfString1 != null) && (arrayOfString1.length >= paramInt))
      throw new EaseMobException(-1018, "the max group members are reached!");
    try
    {
      createPublicXmppMUC(str3, paramString1, paramString2, str2, paramBoolean, paramInt);
      if (arrayOfString1 != null)
        for (localObject1 : arrayOfString1)
        {
          String str4 = EMContactManager.getEidFromUserName((String)localObject1);
          addUserToMUC(str3, str4, true);
        }
      Object localObject1 = new EMGroup(str1);
      ((EMGroup)localObject1).setGroupName(paramString1);
      ((EMGroup)localObject1).setDescription(paramString2);
      ((EMGroup)localObject1).setOwner(EMChatManager.getInstance().getCurrentUser());
      ((EMGroup)localObject1).setPublic(true);
      ((EMGroup)localObject1).setMaxUsers(paramInt);
      ArrayList localArrayList = new ArrayList();
      localArrayList.add(((EMGroup)localObject1).getOwner());
      if (arrayOfString1 != null)
        for (Object localObject2 : arrayOfString1)
          localArrayList.add(localObject2);
      ((EMGroup)localObject1).setMembers(localArrayList);
      ((EMGroup)localObject1).setAffiliationsCount(localArrayList.size());
      e.a().a((EMGroup)localObject1);
      this.allGroups.put(((EMGroup)localObject1).getGroupId(), localObject1);
      return localObject1;
    }
    catch (Exception localException)
    {
      localException.printStackTrace();
      throw new EaseMobException(localException.toString());
    }
  }

  public EMGroup createPrivateGroup(String paramString1, String paramString2, String[] paramArrayOfString)
    throws EaseMobException
  {
    return createPrivateGroup(paramString1, paramString2, paramArrayOfString, false);
  }

  public EMGroup createPrivateGroup(String paramString1, String paramString2, String[] paramArrayOfString, boolean paramBoolean)
    throws EaseMobException
  {
    return createPrivateGroup(paramString1, paramString2, paramArrayOfString, paramBoolean, 200);
  }

  public EMGroup createPrivateGroup(String paramString1, String paramString2, String[] paramArrayOfString, boolean paramBoolean, int paramInt)
    throws EaseMobException
  {
    String str1 = generateGroupId();
    String str2 = EMChatManager.getInstance().getCurrentUser();
    String str3 = EMContactManager.getEidFromGroupId(str1);
    String[] arrayOfString1 = filterOwnerFromMembers(str2, paramArrayOfString);
    if ((arrayOfString1 == null) && (paramInt < 1))
      throw new EaseMobException(-1018, "the max group members are reached!");
    if ((arrayOfString1 != null) && (arrayOfString1.length >= paramInt))
      throw new EaseMobException(-1018, "the max group members are reached!");
    try
    {
      createPrivateXmppMUC(str3, paramString1, paramString2, str2, paramBoolean, paramInt);
      if (arrayOfString1 != null)
        for (localObject1 : arrayOfString1)
        {
          String str4 = EMContactManager.getEidFromUserName((String)localObject1);
          addUserToMUC(str3, str4, true);
        }
      Object localObject1 = new EMGroup(str1);
      ((EMGroup)localObject1).setGroupName(paramString1);
      ((EMGroup)localObject1).setDescription(paramString2);
      ((EMGroup)localObject1).setMaxUsers(paramInt);
      ((EMGroup)localObject1).setOwner(EMChatManager.getInstance().getCurrentUser());
      ArrayList localArrayList = new ArrayList();
      localArrayList.add(((EMGroup)localObject1).getOwner());
      if (arrayOfString1 != null)
        for (Object localObject2 : arrayOfString1)
          localArrayList.add(localObject2);
      ((EMGroup)localObject1).setMembers(localArrayList);
      ((EMGroup)localObject1).setAffiliationsCount(localArrayList.size());
      e.a().a((EMGroup)localObject1);
      getAllGroup().put(((EMGroup)localObject1).getGroupId(), localObject1);
      return localObject1;
    }
    catch (Exception localException)
    {
      localException.printStackTrace();
      throw new EaseMobException(localException.toString());
    }
  }

  Map<String, EMGroup> getAllGroup()
  {
    return this.allGroups;
  }

  public EMGroup createGroup(String paramString1, String paramString2, String[] paramArrayOfString)
    throws EaseMobException
  {
    return createPrivateGroup(paramString1, paramString2, paramArrayOfString);
  }

  private void createPrivateXmppMUC(String paramString1, String paramString2, String paramString3, String paramString4, boolean paramBoolean, int paramInt)
    throws Exception
  {
    XMPPConnection localXMPPConnection = this.xmppConnectionManager.getConnection();
    MultiUserChat localMultiUserChat = new MultiUserChat(localXMPPConnection, paramString1);
    EMLog.d(TAG, "create muc room jid:" + paramString1 + " roomName:" + paramString2 + " owner:" + paramString4 + " allowInvites:" + paramBoolean);
    try
    {
      localMultiUserChat.create(paramString4);
      Form localForm1 = localMultiUserChat.getConfigurationForm();
      Form localForm2 = localForm1.createAnswerForm();
      Iterator localIterator = localForm1.getFields();
      while (localIterator.hasNext())
      {
        FormField localFormField = (FormField)localIterator.next();
        if ((!"hidden".equals(localFormField.getType())) && (localFormField.getVariable() != null))
          localForm2.setDefaultAnswer(localFormField.getVariable());
      }
      localForm2.setAnswer("muc#roomconfig_persistentroom", true);
      localForm2.setAnswer("muc#roomconfig_membersonly", true);
      localForm2.setAnswer("muc#roomconfig_moderatedroom", true);
      if (paramInt > 0)
        localForm2.setAnswer("muc#roomconfig_maxusers", paramInt);
      localForm2.setAnswer("muc#roomconfig_publicroom", false);
      localForm2.setAnswer("members_by_default", true);
      localForm2.setAnswer("muc#roomconfig_allowinvites", paramBoolean);
      localForm2.setAnswer("muc#roomconfig_roomname", paramString2);
      localForm2.setAnswer("muc#roomconfig_roomdesc", paramString3);
      localMultiUserChat.sendConfigurationForm(localForm2);
      localMultiUserChat.join(paramString4);
      addMuc(paramString1, localMultiUserChat);
      EMLog.d(TAG, "muc created:" + localMultiUserChat.getRoom());
    }
    catch (XMPPException localXMPPException)
    {
      localXMPPException.printStackTrace();
      throw localXMPPException;
    }
  }

  private void createPublicXmppMUC(String paramString1, String paramString2, String paramString3, String paramString4, boolean paramBoolean, int paramInt)
    throws Exception
  {
    XMPPConnection localXMPPConnection = this.xmppConnectionManager.getConnection();
    MultiUserChat localMultiUserChat = new MultiUserChat(localXMPPConnection, paramString1);
    EMLog.d(TAG, "create muc room jid:" + paramString1 + " roomName:" + paramString2 + " owner:" + paramString4);
    try
    {
      localMultiUserChat.create(paramString4);
      Form localForm1 = localMultiUserChat.getConfigurationForm();
      Form localForm2 = localForm1.createAnswerForm();
      Iterator localIterator = localForm1.getFields();
      while (localIterator.hasNext())
      {
        FormField localFormField = (FormField)localIterator.next();
        if ((!"hidden".equals(localFormField.getType())) && (localFormField.getVariable() != null))
          localForm2.setDefaultAnswer(localFormField.getVariable());
      }
      localForm2.setAnswer("muc#roomconfig_persistentroom", true);
      localForm2.setAnswer("muc#roomconfig_moderatedroom", false);
      localForm2.setAnswer("muc#roomconfig_publicroom", true);
      if (paramBoolean)
        localForm2.setAnswer("muc#roomconfig_membersonly", true);
      else
        localForm2.setAnswer("muc#roomconfig_membersonly", false);
      localForm2.setAnswer("members_by_default", true);
      localForm2.setAnswer("muc#roomconfig_roomname", paramString2);
      localForm2.setAnswer("muc#roomconfig_roomdesc", paramString3);
      if (paramInt > 0)
        localForm2.setAnswer("muc#roomconfig_maxusers", paramInt);
      localMultiUserChat.sendConfigurationForm(localForm2);
      localMultiUserChat.join(paramString4);
      addMuc(paramString1, localMultiUserChat);
      EMLog.d(TAG, "muc created:" + localMultiUserChat.getRoom());
    }
    catch (XMPPException localXMPPException)
    {
      localXMPPException.printStackTrace();
      throw localXMPPException;
    }
  }

  public void exitAndDeleteGroup(String paramString)
    throws EaseMobException
  {
    EMGroup localEMGroup1 = (EMGroup)getAllGroup().get(paramString);
    if (localEMGroup1 == null)
      throw new EaseMobException(-1016, "group doesn't exist in local:" + paramString);
    checkGroupOwner(localEMGroup1, "only group owner can delete group");
    try
    {
      String str = EMContactManager.getEidFromGroupId(paramString);
      deleteMUC(str);
      EMGroup localEMGroup2 = (EMGroup)getAllGroup().get(paramString);
      if (localEMGroup2 != null)
        deleteLocalGroup(paramString);
    }
    catch (Exception localException)
    {
      localException.printStackTrace();
      throw new EaseMobException(localException.toString());
    }
  }

  synchronized MultiUserChat getMUC(String paramString)
    throws XMPPException
  {
    if (!paramString.contains("@"))
      paramString = paramString + EMChatConfig.MUC_DOMAIN_SUFFIX;
    MultiUserChat localMultiUserChat = (MultiUserChat)this.multiUserChats.get(paramString);
    if (localMultiUserChat == null)
    {
      localMultiUserChat = new MultiUserChat(this.xmppConnectionManager.getConnection(), paramString);
      addMuc(paramString, localMultiUserChat);
    }
    if (!localMultiUserChat.isJoined())
    {
      String str = EMChatManager.getInstance().getCurrentUser();
      localMultiUserChat.join(str);
      EMLog.d(TAG, "joined muc:" + localMultiUserChat.getRoom() + " with eid:" + str);
    }
    return localMultiUserChat;
  }

  synchronized MultiUserChat getMUCWithoutJoin(String paramString)
    throws XMPPException
  {
    if (!paramString.contains("@"))
      paramString = paramString + EMChatConfig.MUC_DOMAIN_SUFFIX;
    MultiUserChat localMultiUserChat = (MultiUserChat)this.multiUserChats.get(paramString);
    if (localMultiUserChat == null)
    {
      localMultiUserChat = new MultiUserChat(this.xmppConnectionManager.getConnection(), paramString);
      addMuc(paramString, localMultiUserChat);
    }
    return localMultiUserChat;
  }

  private void deleteMUC(String paramString)
    throws XMPPException
  {
    MultiUserChat localMultiUserChat = getMUC(paramString);
    localMultiUserChat.destroy("delete-group", null);
  }

  private void leaveMUC(String paramString1, String paramString2)
    throws XMPPException
  {
    MultiUserChat localMultiUserChat = getMUC(paramString1);
    localMultiUserChat.leave();
  }

  private void leaveMUCRemoveMember(String paramString1, String paramString2)
    throws XMPPException
  {
    MultiUserChat localMultiUserChat = null;
    try
    {
      localMultiUserChat = getMUC(paramString1);
    }
    catch (XMPPException localXMPPException)
    {
      if ((localXMPPException.getMessage().contains("403")) || (localXMPPException.getMessage().contains("407")))
        return;
      throw new XMPPException(localXMPPException);
    }
    try
    {
      localMultiUserChat.grantMembership(paramString2);
    }
    catch (Exception localException1)
    {
    }
    localMultiUserChat.leave();
    try
    {
      localMultiUserChat.revokeMembership(paramString2);
    }
    catch (Exception localException2)
    {
      localException2.printStackTrace();
    }
  }

  public void deleteLocalGroup(String paramString)
  {
    EMLog.d(TAG, "delete local group:" + paramString);
    String str = EMContactManager.getEidFromGroupId(paramString);
    MultiUserChat localMultiUserChat = (MultiUserChat)this.multiUserChats.get(str);
    if (localMultiUserChat != null)
    {
      this.multiUserChats.remove(str);
      localMultiUserChat = null;
    }
    e.a().h(paramString);
    getAllGroup().remove(paramString);
    EMChatManager.getInstance().deleteConversation(paramString, true, EMChatManager.getInstance().getChatOptions().isDeleteMessagesAsExitGroup());
  }

  private void checkGroupOwner(EMGroup paramEMGroup, String paramString)
    throws EMPermissionException
  {
    String str1 = paramEMGroup.getOwner();
    String str2 = EMChatManager.getInstance().getCurrentUser();
    if ((str1 == null) || (!str2.equals(str1)))
      throw new EMPermissionException(-1020, paramString);
  }

  public void addUsersToGroup(String paramString, String[] paramArrayOfString)
    throws EaseMobException
  {
    EMGroup localEMGroup1 = (EMGroup)getAllGroup().get(paramString);
    if (localEMGroup1 == null)
      throw new EaseMobException(-1016, "group doesn't exist in local:" + paramString);
    checkGroupOwner(localEMGroup1, "only group owner can add member");
    try
    {
      String str1 = EMContactManager.getEidFromGroupId(paramString);
      EMGroup localEMGroup2 = getMUC(str1, EMChatManager.getInstance().getCurrentUser(), false, true);
      int i = localEMGroup2.getAffiliationsCount();
      int j = localEMGroup2.getMaxUsers();
      if (i >= j)
        throw new EaseMobException(-1018, "the max group members are reached!");
      if (j - i < paramArrayOfString.length)
        throw new EaseMobException(-1019, "there is no room to add new members");
      String str2;
      for (str2 : paramArrayOfString)
      {
        String str3 = EMContactManager.getEidFromUserName(str2);
        addUserToMUC(str1, str3, true);
      }
      for (str2 : paramArrayOfString)
        if (!localEMGroup1.getMembers().contains(str2))
          localEMGroup1.addMember(str2);
      localEMGroup1.setAffiliationsCount(localEMGroup1.getMembers().size());
      e.a().b(localEMGroup1);
    }
    catch (Exception localException)
    {
      localException.printStackTrace();
      if ((localException instanceof EaseMobException))
        throw ((EaseMobException)localException);
      throw new EaseMobException(-1, localException.getMessage());
    }
  }

  private void addUserToMUC(String paramString1, String paramString2, boolean paramBoolean)
    throws XMPPException
  {
    EMLog.d(TAG, "muc add user:" + paramString2 + " to chat room:" + paramString1);
    MultiUserChat localMultiUserChat = getMUC(paramString1);
    if (paramBoolean)
      localMultiUserChat.invite(paramString2, "EaseMob-Group");
    localMultiUserChat.grantMembership(paramString2);
  }

  public void removeUserFromGroup(String paramString1, String paramString2)
    throws EaseMobException
  {
    EMGroup localEMGroup = (EMGroup)getAllGroup().get(paramString1);
    if (localEMGroup == null)
      throw new EaseMobException(-1016, "group doesn't exist in local:" + paramString1);
    checkGroupOwner(localEMGroup, "only group owner can remove member");
    String str1 = EMContactManager.getEidFromGroupId(paramString1);
    String str2 = EMContactManager.getEidFromUserName(paramString2);
    try
    {
      removeUserFromMUC(str1, str2);
      localEMGroup.removeMember(paramString2);
      localEMGroup.setAffiliationsCount(localEMGroup.getMembers().size());
      e.a().b(localEMGroup);
    }
    catch (Exception localException)
    {
      localException.printStackTrace();
    }
  }

  private void removeUserFromMUC(String paramString1, String paramString2)
    throws Exception
  {
    EMLog.d(TAG, "muc remove user:" + paramString2 + " from chat room:" + paramString1);
    MultiUserChat localMultiUserChat = getMUC(paramString1);
    localMultiUserChat.revokeMembership(paramString2);
    String str = EMContactManager.getUserNameFromEid(paramString2);
    try
    {
      EMLog.d(TAG, "try to kick user if already joined");
      localMultiUserChat.kickParticipant(str, "RemoveFromGroup");
    }
    catch (Exception localException)
    {
      localException.printStackTrace();
    }
  }

  void joinMUC(String paramString1, String paramString2)
    throws XMPPException
  {
    MultiUserChat localMultiUserChat = (MultiUserChat)this.multiUserChats.get(paramString1);
    if (localMultiUserChat == null)
      localMultiUserChat = new MultiUserChat(this.xmppConnectionManager.getConnection(), paramString1);
    localMultiUserChat.join(paramString2);
    EMLog.d(TAG, "joined muc:" + paramString1);
    try
    {
      Collection localCollection = localMultiUserChat.getMembers();
      EMLog.d(TAG, "  room members size:" + localCollection.size());
      Iterator localIterator = localCollection.iterator();
      while (localIterator.hasNext())
      {
        Affiliate localAffiliate = (Affiliate)localIterator.next();
        EMLog.d(TAG, "  member jid:" + localAffiliate.getJid() + " role:" + localAffiliate.getRole());
      }
    }
    catch (Exception localException)
    {
      localException.printStackTrace();
    }
  }

  public void exitFromGroup(String paramString)
    throws EaseMobException
  {
    try
    {
      EMGroup localEMGroup = (EMGroup)getAllGroup().get(paramString);
      String str1 = EMContactManager.getEidFromGroupId(paramString);
      String str2 = EMChatManager.getInstance().getCurrentUser();
      String str3 = EMContactManager.getEidFromUserName(str2);
      leaveMUCRemoveMember(str1, str3);
      deleteLocalGroup(paramString);
    }
    catch (Exception localException)
    {
      localException.printStackTrace();
      throw new EaseMobException(localException.toString());
    }
  }

  public EMGroup getGroupFromServer(String paramString)
    throws EaseMobException
  {
    if (paramString == null)
      throw new EaseMobException(-1017, "group id is null");
    try
    {
      String str1 = EMContactManager.getEidFromGroupId(paramString);
      String str2 = EMChatManager.getInstance().getCurrentUser();
      EMGroup localEMGroup = getMUC(str1, str2, true, false);
      if (localEMGroup == null)
      {
        EMLog.d(TAG, "no group on server or meet error with groupid:" + paramString);
        throw new EaseMobException(-1017, "no group on server or meet error with groupid:" + paramString);
      }
      return localEMGroup;
    }
    catch (Exception localException)
    {
      localException.printStackTrace();
      throw new EaseMobException(localException.toString());
    }
  }

  public EMGroup createOrUpdateLocalGroup(EMGroup paramEMGroup)
  {
    EMGroup localEMGroup1 = e.a().g(paramEMGroup.getGroupId());
    if (localEMGroup1 == null)
      e.a().a(paramEMGroup);
    else
      e.a().b(paramEMGroup);
    EMGroup localEMGroup2 = (EMGroup)getAllGroup().get(paramEMGroup.getGroupId());
    if (localEMGroup2 != null)
    {
      localEMGroup2.copyGroup(paramEMGroup);
      return localEMGroup2;
    }
    getAllGroup().put(paramEMGroup.getGroupId(), paramEMGroup);
    return paramEMGroup;
  }

  EMGroup getMUC(String paramString1, String paramString2, boolean paramBoolean1, boolean paramBoolean2)
    throws XMPPException
  {
    XMPPConnection localXMPPConnection = this.xmppConnectionManager.getConnection();
    RoomInfo localRoomInfo = MultiUserChat.getRoomInfo(localXMPPConnection, paramString1);
    if (localRoomInfo == null)
      return null;
    String str1 = localRoomInfo.getRoomName();
    String str2 = localRoomInfo.getDescription();
    String str3 = EMContactManager.getUserNameFromEid(paramString1);
    EMGroup localEMGroup = new EMGroup(str3);
    localEMGroup.setGroupName(str1);
    localEMGroup.setDescription(str2);
    localEMGroup.membersOnly = localRoomInfo.isMembersOnly();
    localEMGroup.isPublic = localRoomInfo.isPublic();
    localEMGroup.allowInvites = localRoomInfo.isAllowInvites();
    localEMGroup.maxUsers = localRoomInfo.getMaxUsers();
    localEMGroup.affiliationsCount = localRoomInfo.getAffiliationsCount();
    if (localRoomInfo.getOwner() != null)
      localEMGroup.owner = EMContactManager.getGroupIdFromEid(localRoomInfo.getOwner());
    EMLog.d(TAG, "get room info for roomjid:" + paramString1 + " name:" + str1 + " desc:" + str2 + "owner:" + localRoomInfo.getOwner() + " ispublic:" + localEMGroup.isPublic() + " ismemberonly:" + localEMGroup.isMembersOnly() + " isallowinvites:" + localEMGroup.isAllowInvites() + " maxusers:" + localEMGroup.maxUsers + " affCounts:" + localEMGroup.affiliationsCount + " isjoin:" + paramBoolean2 + " owner:" + localEMGroup.owner);
    MultiUserChat localMultiUserChat = getMUCWithoutJoin(paramString1);
    if (paramBoolean2)
      localMultiUserChat.join(paramString2);
    if (!paramBoolean1)
      return localEMGroup;
    try
    {
      Collection localCollection = localMultiUserChat.getOwners();
      Object localObject2 = localCollection.iterator();
      Object localObject4;
      if (((Iterator)localObject2).hasNext())
      {
        localObject1 = (Affiliate)((Iterator)localObject2).next();
        localObject3 = ((Affiliate)localObject1).getJid();
        localObject4 = EMContactManager.getUserNameFromEid((String)localObject3);
        localEMGroup.setOwner((String)localObject4);
        EMLog.d(TAG, " room owner:" + (String)localObject4);
      }
      localEMGroup.addMember(localEMGroup.getOwner());
      Object localObject1 = localMultiUserChat.getMembers();
      Object localObject3 = ((Collection)localObject1).iterator();
      String str4;
      while (((Iterator)localObject3).hasNext())
      {
        localObject2 = (Affiliate)((Iterator)localObject3).next();
        localObject4 = ((Affiliate)localObject2).getJid();
        str4 = EMContactManager.getUserNameFromEid((String)localObject4);
        localEMGroup.addMember(str4);
        EMLog.d(TAG, "  room member:" + str4);
      }
      try
      {
        localObject2 = localMultiUserChat.getAdmins();
        localObject4 = ((Collection)localObject2).iterator();
        while (((Iterator)localObject4).hasNext())
        {
          localObject3 = (Affiliate)((Iterator)localObject4).next();
          str4 = ((Affiliate)localObject3).getJid();
          String str5 = EMContactManager.getUserNameFromEid(str4);
          localEMGroup.addMember(str5);
          String str6 = EMChatManager.getInstance().getCurrentUser();
          if (str5.equals(str6))
          {
            EMLog.d(TAG, " this room is blocked group msg:" + str3);
            localEMGroup.isMsgBlocked = true;
          }
          EMLog.d(TAG, "  room blockedmsg member:" + str5);
        }
      }
      catch (Exception localException2)
      {
        EMLog.d(TAG, "error when retrieve blocked members:" + localException2.toString());
      }
    }
    catch (Exception localException1)
    {
      localException1.printStackTrace();
      EMLog.d(TAG, "error when retrieve group info from server:" + localException1.toString());
      removeMuc(paramString1);
      return null;
    }
    return localEMGroup;
  }

  public synchronized List<EMGroup> getGroupsFromServer()
    throws EaseMobException
  {
    try
    {
      String str = EMContactManager.getEidFromUserName(EMChatManager.getInstance().getCurrentUser());
      List localList = getMUCs(str, false);
      syncGroupsWithRemoteGroupList(localList);
      return localList;
    }
    catch (Exception localException)
    {
      localException.printStackTrace();
      throw new EaseMobException(localException.toString());
    }
  }

  public void asyncGetGroupsFromServer(final EMValueCallBack<List<EMGroup>> paramEMValueCallBack)
  {
    if (paramEMValueCallBack == null)
      throw new RuntimeException("callback is null!");
    this.threadPool.submit(new Runnable()
    {
      public void run()
      {
        try
        {
          List localList = EMGroupManager.this.getGroupsFromServer();
          paramEMValueCallBack.onSuccess(localList);
        }
        catch (EaseMobException localEaseMobException)
        {
          localEaseMobException.printStackTrace();
          int i = EMExceptionUtils.fromExceptionToErrorCode(localEaseMobException);
          if (i == -999)
            i = -998;
          paramEMValueCallBack.onError(i, localEaseMobException.getMessage());
        }
      }
    });
  }

  public List<EMGroupInfo> getAllPublicGroupsFromServer()
    throws EaseMobException
  {
    try
    {
      String str = EMContactManager.getEidFromUserName(EMChatManager.getInstance().getCurrentUser());
      List localList = getPublicMUCs(str, EMChatConfig.getInstance().APPKEY);
      return localList;
    }
    catch (Exception localException)
    {
      localException.printStackTrace();
      throw new EaseMobException(localException.toString());
    }
  }

  public void asyncGetAllPublicGroupsFromServer(final EMValueCallBack<List<EMGroupInfo>> paramEMValueCallBack)
  {
    if (paramEMValueCallBack == null)
      throw new RuntimeException("callback is null!");
    this.threadPool.submit(new Runnable()
    {
      public void run()
      {
        try
        {
          List localList = EMGroupManager.this.getAllPublicGroupsFromServer();
          paramEMValueCallBack.onSuccess(localList);
        }
        catch (EaseMobException localEaseMobException)
        {
          localEaseMobException.printStackTrace();
          int i = EMExceptionUtils.fromExceptionToErrorCode(localEaseMobException);
          if (i == -999)
            i = -998;
          paramEMValueCallBack.onError(i, localEaseMobException.getMessage());
        }
      }
    });
  }

  private void syncGroupsWithRemoteGroupList(List<EMGroup> paramList)
  {
    Object localObject2 = paramList.iterator();
    while (((Iterator)localObject2).hasNext())
    {
      localObject1 = (EMGroup)((Iterator)localObject2).next();
      if (getAllGroup().containsKey(((EMGroup)localObject1).getGroupId()))
      {
        EMLog.d(TAG, " group sync. local already exists:" + ((EMGroup)localObject1).getGroupId());
        createOrUpdateLocalGroup((EMGroup)localObject1);
      }
      else
      {
        createOrUpdateLocalGroup((EMGroup)localObject1);
      }
    }
    Object localObject1 = getAllGroup().keySet();
    localObject2 = new ArrayList();
    Iterator localIterator1 = ((Set)localObject1).iterator();
    String str;
    while (localIterator1.hasNext())
    {
      str = (String)localIterator1.next();
      int i = 0;
      Iterator localIterator2 = paramList.iterator();
      while (localIterator2.hasNext())
      {
        EMGroup localEMGroup = (EMGroup)localIterator2.next();
        if (localEMGroup.getGroupId().equals(str))
        {
          i = 1;
          break;
        }
      }
      if (i == 0)
        ((ArrayList)localObject2).add(str);
    }
    localIterator1 = ((ArrayList)localObject2).iterator();
    while (localIterator1.hasNext())
    {
      str = (String)localIterator1.next();
      EMLog.d(TAG, "delete local group which not exists on server:" + str);
      deleteLocalGroup(str);
    }
  }

  private synchronized void deleteAllLocalGroups()
  {
    Iterator localIterator = getAllGroup().keySet().iterator();
    while (localIterator.hasNext())
    {
      String str = (String)localIterator.next();
      e.a().h(str);
      e.a().i(str);
    }
    this.allGroups.clear();
  }

  private List<EMGroup> getMUCs(String paramString, boolean paramBoolean)
    throws EaseMobException, XMPPException
  {
    EMLog.d(TAG, "needJoin : " + paramBoolean);
    EMTimeTag localEMTimeTag = new EMTimeTag();
    localEMTimeTag.start();
    ArrayList localArrayList = new ArrayList();
    XMPPConnection localXMPPConnection = this.xmppConnectionManager.getConnection();
    Collection localCollection = MultiUserChat.getHostedRooms(localXMPPConnection, EMChatConfig.MUC_DOMAIN);
    EMLog.d(TAG, "joined room size:" + localCollection.size());
    Iterator localIterator = localCollection.iterator();
    while (localIterator.hasNext())
    {
      HostedRoom localHostedRoom = (HostedRoom)localIterator.next();
      EMLog.d(TAG, "joined room room jid:" + localHostedRoom.getJid() + " name:" + localHostedRoom.getName());
      String str = EMChatManager.getInstance().getCurrentUser();
      try
      {
        EMGroup localEMGroup = getMUC(localHostedRoom.getJid(), str, false, paramBoolean);
        if (localEMGroup != null)
        {
          EMLog.d(TAG, "  get group detail:" + localEMGroup.getGroupName());
          localArrayList.add(localEMGroup);
        }
      }
      catch (Exception localException)
      {
        localException.printStackTrace();
      }
    }
    EMLog.d(TAG, " retrieved groups from server:" + localArrayList.size());
    if ((localArrayList != null) && (localArrayList.size() > 0))
      EMPerformanceCollector.collectRetrieveGroupsFromServerTime(localArrayList.size(), localEMTimeTag.stop());
    return localArrayList;
  }

  private List<EMGroupInfo> getPublicMUCs(String paramString1, String paramString2)
    throws EaseMobException, XMPPException
  {
    ArrayList localArrayList = new ArrayList();
    XMPPConnection localXMPPConnection = this.xmppConnectionManager.getConnection();
    Collection localCollection = MultiUserChat.getPublicRooms(localXMPPConnection, EMChatConfig.MUC_DOMAIN, paramString2);
    EMLog.d(TAG, "public room size:" + localCollection.size());
    Iterator localIterator = localCollection.iterator();
    while (localIterator.hasNext())
    {
      HostedRoom localHostedRoom = (HostedRoom)localIterator.next();
      String str = formatGroupName(localHostedRoom.getName());
      EMLog.d(TAG, "joined room room jid:" + localHostedRoom.getJid() + " name:" + str);
      EMGroupInfo localEMGroupInfo = new EMGroupInfo(EMContactManager.getGroupIdFromEid(localHostedRoom.getJid()), str);
      localArrayList.add(localEMGroupInfo);
    }
    EMLog.d(TAG, " retrieved public groups from server:" + localArrayList.size());
    return localArrayList;
  }

  private String formatGroupName(String paramString)
  {
    int i = paramString.lastIndexOf(" ");
    if ((paramString.endsWith(")")) && (i > 0))
      return paramString.substring(0, i);
    return paramString;
  }

  void logout()
  {
    this.allGroupLoaded = false;
    EMLog.d(TAG, "group manager logout");
    if (this.allGroups != null)
      this.allGroups.clear();
    if (this.multiUserChats != null)
      this.multiUserChats.clear();
    if (this.groupChangeListeners != null)
      this.groupChangeListeners.clear();
    if ((this.invitationListener != null) && (this.xmppConnectionManager.getConnection() != null))
      try
      {
        MultiUserChat.removeInvitationListener(this.xmppConnectionManager.getConnection(), this.invitationListener);
      }
      catch (Exception localException)
      {
        localException.printStackTrace();
      }
    if (this.offlineGroupEvents != null)
      this.offlineGroupEvents.clear();
  }

  synchronized void clear()
  {
    this.allGroupLoaded = false;
    EMLog.d(TAG, "group manager clear");
    if (this.allGroups != null)
      this.allGroups.clear();
  }

  void removeMucs()
  {
    this.multiUserChats.clear();
  }

  private synchronized void retrieveUserMucsOnServer(String paramString)
    throws Exception
  {
    MUCSearchIQ localMUCSearchIQ = new MUCSearchIQ(paramString, paramString);
    XMPPConnection localXMPPConnection = this.xmppConnectionManager.getConnection();
    PacketTypeFilter local5 = new PacketTypeFilter(IQ.class)
    {
      public boolean accept(Packet paramAnonymousPacket)
      {
        if ((paramAnonymousPacket instanceof IQ))
        {
          IQ localIQ = (IQ)paramAnonymousPacket;
          if (localIQ.getType().equals(IQ.Type.RESULT))
          {
            String str = localIQ.getChildElementXML();
            System.err.println("childXML:" + str);
            Exception localException = new Exception();
            localException.printStackTrace();
            return true;
          }
        }
        return false;
      }
    };
    SearchPacketListener localSearchPacketListener = new SearchPacketListener(null);
    localXMPPConnection.addPacketListener(localSearchPacketListener, local5);
    this.receivedQuery = true;
    localXMPPConnection.sendPacket(localMUCSearchIQ);
    synchronized (this.mutex)
    {
      this.mutex.wait(10000L);
    }
    if (!this.receivedQuery)
    {
      EMLog.e(TAG, "server no response for group search");
      throw new EaseMobException("server timeout");
    }
  }

  public void joinGroup(String paramString)
    throws EaseMobException
  {
    try
    {
      EMLog.d(TAG, "try to joinPublicGroup, current user:" + EMChatManager.getInstance().getCurrentUser() + " groupId:" + paramString);
      String str1 = EMContactManager.getEidFromGroupId(paramString);
      EMGroup localEMGroup = getGroupFromServer(paramString);
      createOrUpdateLocalGroup(localEMGroup);
      MultiUserChat localMultiUserChat = getMUC(str1);
      if ((localMultiUserChat != null) && (!localMultiUserChat.isJoined()))
        localMultiUserChat.join(EMChatManager.getInstance().getCurrentUser());
      String str2 = EMChatManager.getInstance().getCurrentUser();
      String str3 = EMContactManager.getEidFromUserName(str2);
    }
    catch (Exception localException)
    {
      localException.printStackTrace();
      throw new EaseMobException(localException.toString());
    }
  }

  public void changeGroupName(String paramString1, String paramString2)
    throws EaseMobException
  {
    String str = EMContactManager.getEidFromGroupId(paramString1);
    EMGroup localEMGroup = (EMGroup)this.allGroups.get(paramString1);
    if (localEMGroup == null)
      throw new EaseMobException(-1016, "group doesn't exist in local:" + paramString1);
    checkGroupOwner(localEMGroup, "only group owner has this permission");
    try
    {
      MultiUserChat localMultiUserChat = getMUC(str);
      Form localForm1 = localMultiUserChat.getConfigurationForm();
      Form localForm2 = localForm1.createAnswerForm();
      Iterator localIterator = localForm1.getFields();
      while (localIterator.hasNext())
      {
        FormField localFormField = (FormField)localIterator.next();
        if ((!"hidden".equals(localFormField.getType())) && (localFormField.getVariable() != null))
          localForm2.setDefaultAnswer(localFormField.getVariable());
      }
      localForm2.setAnswer("muc#roomconfig_roomname", paramString2);
      localMultiUserChat.sendConfigurationForm(localForm2);
      if ((localMultiUserChat != null) && (!localMultiUserChat.isJoined()))
        localMultiUserChat.join(EMChatManager.getInstance().getCurrentUser());
      localEMGroup.setGroupName(paramString2);
      e.a().b(localEMGroup);
    }
    catch (XMPPException localXMPPException)
    {
      throw new EaseMobException(localXMPPException.getMessage());
    }
  }

  public void addGroupChangeListener(GroupChangeListener paramGroupChangeListener)
  {
    EMLog.d(TAG, "add group change listener:" + paramGroupChangeListener.getClass().getName());
    if (!this.groupChangeListeners.contains(paramGroupChangeListener))
      this.groupChangeListeners.add(paramGroupChangeListener);
  }

  public void removeGroupChangeListener(GroupChangeListener paramGroupChangeListener)
  {
    EMLog.d(TAG, "remove group change listener:" + paramGroupChangeListener.getClass().getName());
    this.groupChangeListeners.remove(paramGroupChangeListener);
  }

  public void acceptInvitation(String paramString)
    throws EaseMobException
  {
    try
    {
      String str = EMContactManager.getEidFromGroupId(paramString);
      MultiUserChat localMultiUserChat = getMUC(str);
      if (!localMultiUserChat.isJoined())
        localMultiUserChat.join(EMChatManager.getInstance().getCurrentUser());
      EMGroup localEMGroup = getGroupFromServer(paramString);
      createOrUpdateLocalGroup(localEMGroup);
    }
    catch (Exception localException)
    {
      localException.printStackTrace();
      throw new EaseMobException(localException.toString());
    }
  }

  void declineInvitation(String paramString1, String paramString2, String paramString3)
  {
    EMLog.d(TAG, "decline invitation:" + paramString1 + " inviter:" + paramString2 + " reason" + paramString3);
    try
    {
      XMPPConnection localXMPPConnection = this.xmppConnectionManager.getConnection();
      String str1 = EMContactManager.getEidFromGroupId(paramString1);
      String str2 = EMContactManager.getEidFromUserName(paramString2);
      MultiUserChat.decline(localXMPPConnection, str1, str2, paramString3);
      deleteLocalGroup(paramString1);
    }
    catch (Exception localException)
    {
      localException.printStackTrace();
    }
  }

  public void acceptApplication(String paramString1, String paramString2)
    throws EaseMobException
  {
    EMGroup localEMGroup = (EMGroup)this.allGroups.get(paramString2);
    if (localEMGroup == null)
      throw new EaseMobException("group doesn't exist:" + paramString2);
    try
    {
      String str1 = EMContactManager.getEidFromGroupId(paramString2);
      String str2 = EMContactManager.getEidFromUserName(paramString1);
      addUserToMUC(str1, str2, false);
      localEMGroup.addMember(paramString1);
      accept(str1, localEMGroup.getGroupName(), str2);
      e.a().b(localEMGroup);
    }
    catch (Exception localException)
    {
      localException.printStackTrace();
      throw new EaseMobException(localException.getMessage());
    }
  }

  public void declineApplication(String paramString1, String paramString2, String paramString3)
    throws EaseMobException
  {
    try
    {
      String str1 = EMContactManager.getEidFromGroupId(paramString2);
      String str2 = EMContactManager.getEidFromUserName(paramString1);
      EMGroup localEMGroup = (EMGroup)this.allGroups.get(paramString2);
      if (localEMGroup == null)
        throw new EaseMobException(-1016, "group doesn't exist in local:" + paramString2);
      decline(str1, localEMGroup.getGroupName(), str2, paramString3);
    }
    catch (Exception localException)
    {
      throw new EaseMobException(localException.getMessage());
    }
  }

  private void addMuc(String paramString, MultiUserChat paramMultiUserChat)
  {
    this.multiUserChats.put(paramString, paramMultiUserChat);
    String str1 = EMContactManager.getGroupIdFromEid(paramString);
    EMGroup localEMGroup = (EMGroup)this.allGroups.get(str1);
    String str2 = "";
    if (localEMGroup != null)
      str2 = localEMGroup.getGroupName();
  }

  private void removeMuc(String paramString)
  {
    MultiUserChat localMultiUserChat = (MultiUserChat)this.multiUserChats.remove(paramString);
    if (localMultiUserChat != null)
      localMultiUserChat = null;
  }

  public void setAutoAcceptInvitation(boolean paramBoolean)
  {
    this.autoAcceptInvitation = paramBoolean;
  }

  public void inviteUser(String paramString1, String[] paramArrayOfString, String paramString2)
    throws EaseMobException
  {
    try
    {
      EMLog.d(TAG, "invite usernames:" + paramArrayOfString + " to group:" + paramString1 + " reason:" + paramString2);
      if (paramString2 == null)
        paramString2 = "";
      String str1 = EMContactManager.getEidFromGroupId(paramString1);
      ArrayList localArrayList = new ArrayList();
      for (localObject : paramArrayOfString)
      {
        String str2 = EMContactManager.getEidFromUserName((String)localObject);
        localArrayList.add(str2);
      }
      Object localObject = getMUC(str1, EMChatManager.getInstance().getCurrentUser(), false, true);
      ??? = ((EMGroup)localObject).getAffiliationsCount();
      ??? = ((EMGroup)localObject).getMaxUsers();
      if (??? == ???)
        throw new EaseMobException(-1018, "群成员数已满");
      if (??? - ??? < localArrayList.size())
        throw new EaseMobException(-1019, "要加入的用户人数超过剩余可加入的人数");
      inviteUserMUC(str1, localArrayList, paramString2);
    }
    catch (Exception localException)
    {
      localException.printStackTrace();
      if ((localException instanceof EaseMobException))
        throw ((EaseMobException)localException);
      throw new EaseMobException(-1, localException.getMessage());
    }
  }

  private void inviteUserMUC(String paramString1, List<String> paramList, String paramString2)
    throws XMPPException
  {
    MultiUserChat localMultiUserChat = getMUC(paramString1);
    EMGroup localEMGroup = getInstance().getGroup(EMContactManager.getGroupIdFromEid(paramString1));
    if ((paramList != null) && (paramList.size() != 0))
    {
      Iterator localIterator = paramList.iterator();
      while (localIterator.hasNext())
      {
        String str = (String)localIterator.next();
        localMultiUserChat.invite(str, paramString2);
        if (localEMGroup.isAllowInvites())
          localEMGroup.addMember(EMContactManager.getUserNameFromEid(str));
      }
    }
    localEMGroup.setAffiliationsCount(localEMGroup.getMembers().size());
  }

  public void applyJoinToGroup(String paramString1, String paramString2)
    throws EaseMobException
  {
    String str1 = EMContactManager.getEidFromGroupId(paramString1);
    String str2 = EMChatManager.getInstance().getCurrentUser();
    String str3 = EMContactManager.getEidFromUserName(str2);
    apply(new Message(), str1, str3, paramString2);
  }

  public void blockGroupMessage(String paramString)
    throws EaseMobException
  {
    EMLog.d(TAG, "try to block group msg:" + paramString);
    String str1 = EMContactManager.getEidFromGroupId(paramString);
    try
    {
      MultiUserChat localMultiUserChat = getMUC(str1);
      String str2 = EMChatManager.getInstance().getCurrentUser();
      EMGroup localEMGroup = getGroup(paramString);
      if (localEMGroup == null)
        throw new EaseMobException(-1016, "group not exist in local");
      if (localEMGroup.getOwner().equals(str2))
        throw new EMPermissionException(-1020, "group owner can not block group messages");
      String str3 = EMContactManager.getEidFromUserName(str2);
      localMultiUserChat.grantAdmin(str3);
      EMLog.d(TAG, "block group msg done:" + paramString);
      localEMGroup.setMsgBlocked(true);
    }
    catch (Exception localException)
    {
      localException.printStackTrace();
      throw new EaseMobException(localException.toString());
    }
  }

  public void unblockGroupMessage(String paramString)
    throws EaseMobException
  {
    EMLog.d(TAG, "try to unblock group msg:" + paramString);
    String str1 = EMContactManager.getEidFromGroupId(paramString);
    try
    {
      MultiUserChat localMultiUserChat = getMUC(str1);
      String str2 = EMChatManager.getInstance().getCurrentUser();
      String str3 = EMContactManager.getEidFromUserName(str2);
      EMGroup localEMGroup = getGroup(paramString);
      if (localEMGroup == null)
        throw new EaseMobException(-1016, "group not exist in local");
      localMultiUserChat.grantMembership(str3);
      localEMGroup.setMsgBlocked(false);
      EMLog.d(TAG, "block group msg done:" + paramString);
    }
    catch (Exception localException)
    {
      localException.printStackTrace();
      throw new EaseMobException(localException.toString());
    }
  }

  public void blockUser(String paramString1, String paramString2)
    throws EaseMobException
  {
    EMLog.d(TAG, "block user for groupid:" + paramString1 + " username:" + paramString2);
    EMGroup localEMGroup1 = (EMGroup)this.allGroups.get(paramString1);
    if (localEMGroup1 == null)
      throw new EaseMobException(-1016, "group doesn't exist in local:" + paramString1);
    checkGroupOwner(localEMGroup1, "only group owner has this permission");
    try
    {
      String str1 = EMContactManager.getEidFromGroupId(paramString1);
      String str2 = EMContactManager.getEidFromUserName(paramString2);
      blockUserMuc(str1, str2);
      EMGroup localEMGroup2 = getGroupFromServer(paramString1);
      createOrUpdateLocalGroup(localEMGroup2);
    }
    catch (Exception localException)
    {
      localException.printStackTrace();
      throw new EaseMobException(localException.toString());
    }
  }

  private void blockUserMuc(String paramString1, String paramString2)
    throws XMPPException
  {
    MultiUserChat localMultiUserChat = getMUCWithoutJoin(paramString1);
    try
    {
      localMultiUserChat.kickParticipant(paramString2, "block");
    }
    catch (Exception localException)
    {
    }
    localMultiUserChat.banUser(paramString2, "easemob-block");
  }

  public void unblockUser(String paramString1, String paramString2)
    throws EaseMobException
  {
    EMLog.d(TAG, "unblock user groupid:" + paramString1 + " username:" + paramString2);
    EMGroup localEMGroup = (EMGroup)this.allGroups.get(paramString1);
    if (localEMGroup == null)
      throw new EaseMobException(-1016, "group doesn't exist in local:" + paramString1);
    checkGroupOwner(localEMGroup, "only group owner has this permission");
    try
    {
      String str1 = EMContactManager.getEidFromGroupId(paramString1);
      String str2 = EMContactManager.getEidFromUserName(paramString2);
      unblockUserMuc(str1, str2);
    }
    catch (Exception localException)
    {
      localException.printStackTrace();
      throw new EaseMobException(localException.toString());
    }
  }

  private void unblockUserMuc(String paramString1, String paramString2)
    throws XMPPException
  {
    MultiUserChat localMultiUserChat = getMUCWithoutJoin(paramString1);
    localMultiUserChat.revokeMembership(paramString2);
  }

  public List<String> getBlockedUsers(String paramString)
    throws EaseMobException
  {
    EMLog.d(TAG, "get blocked users for group:" + paramString);
    try
    {
      String str = EMContactManager.getEidFromGroupId(paramString);
      return getBlockedUsersMuc(str);
    }
    catch (Exception localException)
    {
      localException.printStackTrace();
      throw new EaseMobException(localException.toString());
    }
  }

  private List<String> getBlockedUsersMuc(String paramString)
    throws XMPPException
  {
    ArrayList localArrayList = new ArrayList();
    MultiUserChat localMultiUserChat = getMUCWithoutJoin(paramString);
    Collection localCollection = localMultiUserChat.getOutcasts();
    Object localObject2 = localCollection.iterator();
    Object localObject1;
    while (((Iterator)localObject2).hasNext())
    {
      localObject1 = (Affiliate)((Iterator)localObject2).next();
      ((Affiliate)localObject1).getJid();
    }
    try
    {
      localObject1 = localMultiUserChat.getOutcasts();
      Iterator localIterator = ((Collection)localObject1).iterator();
      while (localIterator.hasNext())
      {
        localObject2 = (Affiliate)localIterator.next();
        EMLog.d(TAG, "blocked  member jid:" + ((Affiliate)localObject2).getJid());
        String str1 = ((Affiliate)localObject2).getJid();
        String str2 = EMContactManager.getUserNameFromEid(str1);
        localArrayList.add(str2);
      }
    }
    catch (XMPPException localXMPPException)
    {
      throw localXMPPException;
    }
    catch (Exception localException)
    {
      localException.printStackTrace();
    }
    return localArrayList;
  }

  void processOfflineMessages()
  {
    EMLog.d(TAG, "process offline group event start: " + this.offlineGroupEvents.size());
    Iterator localIterator1 = this.offlineGroupEvents.iterator();
    while (localIterator1.hasNext())
    {
      GroupChangeEvent localGroupChangeEvent = (GroupChangeEvent)localIterator1.next();
      Object localObject2;
      Object localObject1;
      switch ($SWITCH_TABLE$com$easemob$chat$EMGroupManager$GroupEventType()[localGroupChangeEvent.type.ordinal()])
      {
      case 1:
        localObject2 = this.groupChangeListeners.iterator();
        while (((Iterator)localObject2).hasNext())
        {
          localObject1 = (GroupChangeListener)((Iterator)localObject2).next();
          EMLog.d(TAG, "fire group inviatation received event for group:" + localGroupChangeEvent.groupName + " listener:" + localObject1.hashCode());
          ((GroupChangeListener)localObject1).onInvitationReceived(localGroupChangeEvent.groupId, localGroupChangeEvent.groupName, localGroupChangeEvent.inviterUserName, localGroupChangeEvent.reason);
        }
        break;
      case 2:
        localObject2 = this.groupChangeListeners.iterator();
        while (((Iterator)localObject2).hasNext())
        {
          localObject1 = (GroupChangeListener)((Iterator)localObject2).next();
          EMLog.d(TAG, "fire group application received event for group:" + localGroupChangeEvent.groupName + " listener:" + localObject1.hashCode());
          ((GroupChangeListener)localObject1).onApplicationReceived(localGroupChangeEvent.groupId, localGroupChangeEvent.groupName, localGroupChangeEvent.inviterUserName, localGroupChangeEvent.reason);
        }
        break;
      case 3:
        try
        {
          localObject1 = EMContactManager.getEidFromGroupId(localGroupChangeEvent.groupId);
          localObject2 = getMUC((String)localObject1, EMChatManager.getInstance().getCurrentUser(), false, true);
          createOrUpdateLocalGroup((EMGroup)localObject2);
          Iterator localIterator2 = this.groupChangeListeners.iterator();
          while (localIterator2.hasNext())
          {
            GroupChangeListener localGroupChangeListener2 = (GroupChangeListener)localIterator2.next();
            EMLog.d(TAG, "fire group application accept received event for group:" + localGroupChangeEvent.groupName + " listener:" + localGroupChangeListener2.hashCode());
            localGroupChangeListener2.onApplicationAccept(localGroupChangeEvent.groupId, localGroupChangeEvent.groupName, localGroupChangeEvent.inviterUserName);
          }
        }
        catch (XMPPException localXMPPException)
        {
          localXMPPException.printStackTrace();
        }
      case 4:
        localObject2 = this.groupChangeListeners.iterator();
        while (((Iterator)localObject2).hasNext())
        {
          GroupChangeListener localGroupChangeListener1 = (GroupChangeListener)((Iterator)localObject2).next();
          EMLog.d(TAG, "fire group application declind received event for group:" + localGroupChangeEvent.groupName + " listener:" + localGroupChangeListener1.hashCode());
          localGroupChangeListener1.onApplicationDeclined(localGroupChangeEvent.groupId, localGroupChangeEvent.groupName, localGroupChangeEvent.inviterUserName, localGroupChangeEvent.reason);
        }
      }
    }
    this.offlineGroupEvents.clear();
    EMLog.d(TAG, "proess offline group event finish");
  }

  private void apply(Message paramMessage, String paramString1, String paramString2, String paramString3)
    throws EaseMobException
  {
    try
    {
      EMGroup localEMGroup = getMUC(paramString1, EMChatManager.getInstance().getCurrentUser(), true, false);
      paramMessage.setTo(EMContactManager.getEidFromUserName(localEMGroup.getOwner()));
      MUCUser localMUCUser = new MUCUser();
      MUCUser.Apply localApply = new MUCUser.Apply();
      localApply.setFrom(paramString2);
      localApply.setTo(paramString1);
      localApply.setReason(paramString3);
      localApply.setToNick(localEMGroup.getGroupName());
      localMUCUser.setApply(localApply);
      paramMessage.addExtension(localMUCUser);
      this.xmppConnectionManager.getConnection().sendPacket(paramMessage);
    }
    catch (Exception localException)
    {
      throw new EaseMobException(localException.getMessage());
    }
  }

  private void decline(String paramString1, String paramString2, String paramString3, String paramString4)
  {
    Message localMessage = new Message(paramString3);
    MUCUser localMUCUser = new MUCUser();
    MUCUser.Decline localDecline = new MUCUser.Decline();
    localDecline.setTo(paramString1);
    localDecline.setFrom(EMContactManager.getEidFromUserName(EMChatManager.getInstance().getCurrentUser()));
    localDecline.setFromNick(paramString2);
    localDecline.setReason(paramString4);
    localDecline.setType(MUCUser.MucType.Apply);
    localMUCUser.setDecline(localDecline);
    localMessage.addExtension(localMUCUser);
    this.xmppConnectionManager.getConnection().sendPacket(localMessage);
  }

  private void accept(String paramString1, String paramString2, String paramString3)
  {
    Message localMessage = new Message(paramString3);
    MUCUser localMUCUser = new MUCUser();
    MUCUser.Accept localAccept = new MUCUser.Accept();
    localAccept.setFrom(EMContactManager.getEidFromUserName(EMChatManager.getInstance().getCurrentUser()));
    localAccept.setTo(paramString1);
    localAccept.setFromNick(paramString2);
    localMUCUser.setAccept(localAccept);
    localMessage.addExtension(localMUCUser);
    this.xmppConnectionManager.getConnection().sendPacket(localMessage);
  }

  private class GroupChangeEvent
  {
    String groupId;
    String groupName;
    String inviterUserName;
    String reason;
    EMGroupManager.GroupEventType type;

    public GroupChangeEvent(EMGroupManager.GroupEventType paramString1, String paramString2, String paramString3, String paramString4, String arg6)
    {
      this.type = paramString1;
      this.groupId = paramString2;
      this.groupName = paramString3;
      this.inviterUserName = paramString4;
      Object localObject;
      this.reason = localObject;
    }
  }

  private static enum GroupEventType
  {
    Invitate, Apply, ApplicationAccept, ApplicationDeclind;
  }

  private class MUCInvitationListener
    implements InvitationListener
  {
    private MUCInvitationListener()
    {
    }

    public void invitationReceived(Connection paramConnection, String paramString1, String paramString2, String paramString3, String paramString4, Message paramMessage)
    {
      EMLog.d(EMGroupManager.TAG, "invitation received room:" + paramString1 + " inviter:" + paramString2 + " reason:" + paramString3 + " message:" + paramMessage.getBody());
      String str1 = EMContactManager.getUserNameFromEid(paramString2);
      String str2 = EMContactManager.getGroupIdFromEid(paramString1);
      XMPPConnection localXMPPConnection = EMGroupManager.this.xmppConnectionManager.getConnection();
      String str3 = str2;
      try
      {
        RoomInfo localRoomInfo = MultiUserChat.getRoomInfo(localXMPPConnection, paramString1);
        if (localRoomInfo != null)
          str3 = localRoomInfo.getRoomName();
      }
      catch (Exception localException1)
      {
        localException1.printStackTrace();
      }
      EMGroup localEMGroup = new EMGroup(str2);
      localEMGroup.setGroupId(str2);
      localEMGroup.setGroupName(str3);
      EMGroupManager.this.createOrUpdateLocalGroup(localEMGroup);
      if (EMGroupManager.this.autoAcceptInvitation)
        try
        {
          EMLog.d(EMGroupManager.TAG, "auto accept group invitation for group:" + str3);
          EMGroupManager.this.acceptInvitation(str2);
        }
        catch (Exception localException2)
        {
          localException2.printStackTrace();
        }
      if (EMChat.getInstance().appInited)
      {
        Iterator localIterator = EMGroupManager.this.groupChangeListeners.iterator();
        while (localIterator.hasNext())
        {
          GroupChangeListener localGroupChangeListener = (GroupChangeListener)localIterator.next();
          EMLog.d(EMGroupManager.TAG, "fire group inviatation received event for group:" + str3);
          localGroupChangeListener.onInvitationReceived(str2, str3, str1, paramString3);
        }
      }
      else
      {
        EMLog.d(EMGroupManager.TAG, "aff offline group inviatation received event for group:" + str3);
        EMGroupManager.this.offlineGroupEvents.add(new EMGroupManager.GroupChangeEvent(EMGroupManager.this, EMGroupManager.GroupEventType.Invitate, str2, str3, str1, paramString3));
      }
    }
  }

  private class MUCPresenceListener
    implements PacketListener
  {
    private static final String MUC_ELEMENT_NAME = "x";
    private static final String ITEM_DESTROY = "destroy";
    private static final String ITEM_EXITMUC = "<item affiliation=\"none\" role=\"none\">";
    private static final String AFFILIATION_NONE = "affiliation=\"none\"";
    private static final String ROLE_NONE = "role=\"none\"";

    public MUCPresenceListener()
    {
    }

    public synchronized void processPacket(Packet paramPacket)
    {
      try
      {
        Presence localPresence = (Presence)paramPacket;
        if (localPresence.getType() != Presence.Type.unavailable)
          return;
        PacketExtension localPacketExtension = localPresence.getExtension("x", "http://jabber.org/protocol/muc#user");
        if (localPacketExtension != null)
        {
          String str1 = localPacketExtension.toXML();
          if (str1.contains("destroy"))
          {
            String str2 = paramPacket.getFrom();
            handleRoomDestroy(str2);
          }
          else if ((str1.contains("affiliation=\"none\"")) && (str1.contains("role=\"none\"")))
          {
            if (str1.contains("shutdown"))
              EMLog.d(EMGroupManager.TAG, "skip muc shutdown event");
            else
              handleUserRemove(paramPacket.getFrom());
          }
        }
      }
      catch (Exception localException)
      {
        localException.printStackTrace();
      }
    }

    private void handleRoomDestroy(String paramString)
    {
      String str1 = EMContactManager.getGroupIdFromEid(paramString);
      EMGroup localEMGroup = (EMGroup)EMGroupManager.this.allGroups.get(str1);
      String str2 = "";
      if (localEMGroup != null)
        str2 = localEMGroup.getGroupName();
      EMLog.d(EMGroupManager.TAG, "group has been destroy on server:" + str1 + " name:" + str2);
      EMGroupManager.this.deleteLocalGroup(str1);
      Iterator localIterator = EMGroupManager.this.groupChangeListeners.iterator();
      while (localIterator.hasNext())
      {
        GroupChangeListener localGroupChangeListener = (GroupChangeListener)localIterator.next();
        localGroupChangeListener.onGroupDestroy(str1, str2);
      }
    }

    private void handleUserRemove(String paramString)
    {
      int i = paramString.indexOf("/");
      String str2 = null;
      if (i > 0)
      {
        str2 = paramString.substring(i + 1);
        String str1 = paramString.substring(0, i);
        String str3 = EMContactManager.getGroupIdFromEid(str1);
        if (str2.equals(EMChatManager.getInstance().getCurrentUser()))
        {
          EMLog.d(EMGroupManager.TAG, "user " + str2 + " has been removed from group:" + str3);
          String str4 = "";
          EMGroup localEMGroup = (EMGroup)EMGroupManager.this.allGroups.get(str3);
          if (localEMGroup != null)
            str4 = localEMGroup.getGroupName();
          EMGroupManager.this.deleteLocalGroup(str3);
          Iterator localIterator = EMGroupManager.this.groupChangeListeners.iterator();
          while (localIterator.hasNext())
          {
            GroupChangeListener localGroupChangeListener = (GroupChangeListener)localIterator.next();
            localGroupChangeListener.onUserRemoved(str3, str4);
          }
        }
      }
    }
  }

  private class MUCSearchIQ extends IQ
  {
    public MUCSearchIQ(String paramString1, String arg3)
    {
      setType(IQ.Type.GET);
      setFrom(paramString1);
      String str;
      setTo(str);
    }

    public String getChildElementXML()
    {
      return "<query xmlns='http://jabber.org/protocol/disco#items' node='http://jabber.org/protocol/muc#rooms'/>";
    }
  }

  class MucApplyListener
    implements PacketListener
  {
    private static final String TAG = "MucApplyListener";

    MucApplyListener()
    {
    }

    public void processPacket(Packet paramPacket)
    {
      if (!(paramPacket instanceof Message))
        return;
      Message localMessage = (Message)paramPacket;
      PacketExtension localPacketExtension = localMessage.getExtension("x", "http://jabber.org/protocol/muc#user");
      if (localPacketExtension != null)
      {
        MUCUser localMUCUser = (MUCUser)localPacketExtension;
        MUCUser.Apply localApply = localMUCUser.getApply();
        MUCUser.Accept localAccept = localMUCUser.getAccept();
        MUCUser.Decline localDecline = localMUCUser.getDecline();
        String str1;
        String str2;
        Object localObject2;
        Object localObject1;
        if (localApply != null)
        {
          str1 = EMContactManager.getUserNameFromEid(localApply.getFrom());
          str2 = EMContactManager.getGroupIdFromEid(localApply.getTo());
          if (EMChat.getInstance().appInited)
          {
            localObject2 = EMGroupManager.this.groupChangeListeners.iterator();
            while (((Iterator)localObject2).hasNext())
            {
              localObject1 = (GroupChangeListener)((Iterator)localObject2).next();
              EMLog.d("MucApplyListener", "fire group application received event for group:" + localApply.getToNick());
              ((GroupChangeListener)localObject1).onApplicationReceived(str2, localApply.getToNick(), str1, localApply.getReason());
            }
          }
          else
          {
            EMLog.d("MucApplyListener", "aff offline group application received event for group:" + localApply.getToNick());
            EMGroupManager.this.offlineGroupEvents.add(new EMGroupManager.GroupChangeEvent(EMGroupManager.this, EMGroupManager.GroupEventType.Apply, str2, localApply.getToNick(), str1, localApply.getReason()));
          }
        }
        else if (localAccept != null)
        {
          str1 = EMContactManager.getUserNameFromEid(localAccept.getFrom());
          str2 = EMContactManager.getGroupIdFromEid(localAccept.getTo());
          if (EMChat.getInstance().appInited)
          {
            try
            {
              localObject1 = EMGroupManager.this.getMUC(localAccept.getTo(), EMChatManager.getInstance().getCurrentUser(), false, true);
              EMGroupManager.this.createOrUpdateLocalGroup((EMGroup)localObject1);
              Iterator localIterator = EMGroupManager.this.groupChangeListeners.iterator();
              while (localIterator.hasNext())
              {
                localObject2 = (GroupChangeListener)localIterator.next();
                EMLog.d("MucApplyListener", "fire group application accept received event for group:" + localAccept.getFromNick());
                ((GroupChangeListener)localObject2).onApplicationAccept(str2, localAccept.getFromNick(), str1);
              }
            }
            catch (XMPPException localXMPPException)
            {
              localXMPPException.printStackTrace();
            }
          }
          else
          {
            EMLog.d("MucApplyListener", "aff offline group application accetpt received event for group:" + localAccept.getFromNick());
            EMGroupManager.this.offlineGroupEvents.add(new EMGroupManager.GroupChangeEvent(EMGroupManager.this, EMGroupManager.GroupEventType.ApplicationAccept, str2, localAccept.getFromNick(), str1, localAccept.getReason()));
          }
        }
        else if (localDecline != null)
        {
          str1 = EMContactManager.getUserNameFromEid(localDecline.getFrom());
          str2 = EMContactManager.getGroupIdFromEid(localDecline.getTo());
          if (EMChat.getInstance().appInited)
          {
            localObject2 = EMGroupManager.this.groupChangeListeners.iterator();
            while (((Iterator)localObject2).hasNext())
            {
              GroupChangeListener localGroupChangeListener = (GroupChangeListener)((Iterator)localObject2).next();
              EMLog.d("MucApplyListener", "fire group application declind received event for group:" + localDecline.getFromNick());
              localGroupChangeListener.onApplicationDeclined(str2, localDecline.getFromNick(), str1, localDecline.getReason());
            }
          }
          else
          {
            EMLog.d("MucApplyListener", "aff offline group application declind received event for group:" + localDecline.getFromNick());
            EMGroupManager.this.offlineGroupEvents.add(new EMGroupManager.GroupChangeEvent(EMGroupManager.this, EMGroupManager.GroupEventType.ApplicationDeclind, str2, localDecline.getFromNick(), str1, localDecline.getReason()));
          }
        }
      }
    }
  }

  private class MucUserStatusListener
    implements UserStatusListener
  {
    private String roomJid;

    public MucUserStatusListener(String arg2)
    {
      Object localObject;
      this.roomJid = localObject;
    }

    public void adminGranted()
    {
      System.out.println("admin granted");
    }

    public void adminRevoked()
    {
      System.out.println("admin revoked");
    }

    public void banned(String paramString1, String paramString2)
    {
      System.out.println("banned actor:" + paramString1 + " reason:" + paramString2);
    }

    public void kicked(String paramString1, String paramString2)
    {
      try
      {
        String str1 = EMContactManager.getUserNameFromEid(paramString1);
        EMLog.d(EMGroupManager.TAG, "kicked actor:" + str1 + " reason:" + paramString2);
        String str2 = EMContactManager.getGroupIdFromEid(this.roomJid);
        EMLog.d(EMGroupManager.TAG, "current user has been revoked membership. delete local group:" + str2);
        EMGroupManager.this.deleteLocalGroup(str2);
        Iterator localIterator = EMGroupManager.this.groupChangeListeners.iterator();
        while (localIterator.hasNext())
        {
          GroupChangeListener localGroupChangeListener = (GroupChangeListener)localIterator.next();
          localGroupChangeListener.onUserRemoved(str2, "");
        }
      }
      catch (Exception localException)
      {
        localException.printStackTrace();
      }
    }

    public void membershipGranted()
    {
      System.out.println("membership granted");
    }

    public void membershipRevoked()
    {
      EMLog.d(EMGroupManager.TAG, "membership revoked");
      String str = EMContactManager.getGroupIdFromEid(this.roomJid);
      EMLog.d(EMGroupManager.TAG, "current user has been revoked membership. delete local group:" + str);
      EMGroupManager.this.deleteLocalGroup(str);
      Iterator localIterator = EMGroupManager.this.groupChangeListeners.iterator();
      while (localIterator.hasNext())
      {
        GroupChangeListener localGroupChangeListener = (GroupChangeListener)localIterator.next();
        localGroupChangeListener.onUserRemoved(str, "");
      }
    }

    public void moderatorGranted()
    {
      System.out.println("moderator granted");
    }

    public void moderatorRevoked()
    {
      System.out.println("moderator revoked");
    }

    public void ownershipGranted()
    {
      System.out.println("ownership granted");
    }

    public void ownershipRevoked()
    {
      System.out.println("ownership revoked");
    }

    public void voiceGranted()
    {
      System.out.println("voice granted");
    }

    public void voiceRevoked()
    {
      System.out.println("voice revoked");
    }
  }

  private class RoomQueryIQ extends IQ
  {
    private RoomQueryIQ()
    {
    }

    public String getChildElementXML()
    {
      return "<query xmlns=\"http://jabber.org/protocol/disco#items\" node=\"http://jabber.org/protocol/muc#rooms\"></query>";
    }
  }

  private class SearchPacketListener
    implements PacketListener
  {
    private SearchPacketListener()
    {
    }

    public void processPacket(Packet paramPacket)
    {
      synchronized (EMGroupManager.this.mutex)
      {
        EMGroupManager.this.receivedQuery = true;
        EMGroupManager.this.mutex.notify();
      }
    }
  }
}

/* Location:           D:\hygieia\userclient\common\libs\easemobchat_2.1.8.jar
 * Qualified Name:     com.easemob.chat.EMGroupManager
 * JD-Core Version:    0.6.1
 */